package com.uselaw.api.security;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 登录用户信息
 *
 * @ClassName: ConsumerUser
 * @Description:登录用户信息
 * @author: maxf
 * @date: 2017年11月22日 下午4:39:45
 */
public class ConsumerUser extends User {
    private static final long serialVersionUID = 1L;

    /**
     * 消费者用户主键ID
     */
    private String id;

    public ConsumerUser(String username, String password, boolean enabled, boolean accountNonExpired,
                        boolean credentialsNonExpired, boolean accountNonLocked,
                        Collection<? extends GrantedAuthority> authorities,
                        String id) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
        this.id = id;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(super.toString()).append(": ");

        sb.append("id: ").append(this.id).append("; ");

        return sb.toString();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

}
